//
// Created by Administrator on 2021/5/26.
// @file cm_http_upload_test.c
// @author jmdvirus
// @date 2021-05-26 14:28:02
//

#include "cm_http_upload.h"

int main(int argc, char *argv[])
{

#ifdef USE_LIBCURL
    curl_global_init(CURL_GLOBAL_ALL);
#endif

#if USE_LIBCURL
#if 0
  //char *url = "106.14.61.92:8081/mbm-web/logs/uploadLog.html";
  char *url = "192.168.5.180:12306/upload";
  int ret = cm_http_send_file(argv[1], url, 129);
  printf("---------- %d\n", ret);
#else
    char *url2 = "www.jicuobi.com/index.php/Home/Upload/scanpic.html";
    int   ret  = cm_http_send_file_two(argv[1], url2, "test123");
    printf("---------- %d\n", ret);
#endif
#else
    char *       url = "www.jicuobi.com";
    CMHttpUpload up;
    memset(&up, 0, sizeof(CMHttpUpload));
    strcpy(up.szUploadFileKeyName, "img");

    strcpy(up.szExt[0].key, "imei");
    strcpy(up.szExt[0].value, "test123");
    // strcpy(up.szExt[1].key, "img");
    // strcpy(up.szExt[1].value, argv[1]);

    char uploadpath[1024] = {0};
    sprintf(uploadpath, "index.php/Home/Upload/scanpic.html");
    int ret = cm_http_send_base(&up, url, uploadpath, argv[1]);
    printf("upload result [%d]\n", ret);
#endif

    return 0;
}
